import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  //base: "/py",//配置基路由
  server: {
    port: 5050,//使用5050端口
    host: '0.0.0.0',
    open: true,// 启动开发服务器时自动打开浏览器
    //配置跨域
    proxy: {
      '/api': {
        target: 'http://localhost:8085',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
    //https: true,//启用https
  }
  
})
